package com.example.cloud.model.personal;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.cloud.model.common.CommonModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 * Created by wangtao on 2018/5/21.
 * 考勤记录
 */
@Entity(name = "attendance_record")
@Data
@EqualsAndHashCode(callSuper = false)
public class AttendanceRecord extends CommonModel {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // 申请人主键
    @Column(name = "user_id")
    private Long userId;
    // 申请人
    @Column(name = "user_name")
    private String userName;
    // 记录类型: {1：请假记录 2：调休记录}
    @Column(name = "record_type")
    private int recordType;
    // 请假类型
    @Column(name = "type")
    private int type;
    // 开始时间
    @Column(name = "start_time")
    @JSONField(format = "yyyy-MM-dd HH:mm")
    private Date startTime;
    // 结束时间
    @Column(name = "end_time")
    @JSONField(format = "yyyy-MM-dd HH:mm")
    private Date endTime;
    // 请假事由
    @Column(name = "cause")
    private String cause;
    // 审批状态{0: 待审批 1:已同意 2：已拒绝 3：已调休}
    @Column(name = "status",columnDefinition = "INT default 0")
    private int status;
    // 拒绝原因
    @Column(name = "denial_reason")
    private String denialReason;
    // 被调休记录主键
    @Column(name = "parent_id")
    private Long parentId;
    // 调休原因
    @Column(name = "reasons_rest")
    private String reasonsRest;
    @Transient
    private Integer week;
    @Transient
    private Integer day;
    @Transient
    private Integer isDay = 0;
    @Transient
    private String startTimeStr;
    @Transient
    private String endTimeStr;
    @Transient
    private List<AttendanceRecord> recruitmentList;
    // 账户编号
    @Column(name = "account_id")
    private Long accountId;
    // 组织机构编号
    @Column(name = "organ_id")
    private Long organId;
    // 组织机构名称
    @Column(name = "organ_name")
    private String organName;
}
